
#ifndef _PEG_TIMER_MANAGER_
#define _PEG_TIMER_MANAGER_

class PegThing;         // forward reference

class PegTimerManager
{
    public:
        PegTimerManager(void);
        ~PegTimerManager();

        void KillTimer(PegThing *pWho, PEGUSHORT Id, PEGBOOL Purge = FALSE);

        void SetTimer(PegThing *pWho, PEGUSHORT Id, 
                        PEGLONG Count, PEGLONG Reset);
        void TimerTick();

    private:

        struct PegTimer
        {
            PegTimer() 
            {
                mpNext = NULL; 
                mpTarget = NULL;
            }
            PegTimer(PEGLONG Cnt, PEGLONG Res)
            {
                mpNext = NULL;
                mpTarget = NULL;
                Count = Cnt;
                Reset = Res;
            }
            PegTimer(PegTimer *pNext, PegThing *pWho, PEGUSHORT Id, 
                     PEGLONG Cnt, PEGLONG Res)
            {
                mpNext = pNext;
                mpTarget = pWho;
                Count = Cnt;
                Reset = Res;
                TimerId = Id;
            }
    
            PegTimer *mpNext;
            PegThing *mpTarget;
            PEGLONG    Count;
            PEGLONG    Reset;
            PEGUSHORT  TimerId;
        };

        PegTimer *mpTimerList;
};

#endif
